﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Hangjing.Weixin
{
    public class WXRequestUrlHelper
    {
        /// <summary>
        /// 获取AccessToken请求Url
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="appSecret"></param>
        /// <returns></returns>
        public static string GetAccessTokenUrl(string appId, string appSecret)
        {
            string accessTokenUrl = string.Format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}", appId, appSecret);
            return accessTokenUrl;
        }
        /// <summary>
        /// 获取apiticket
        /// </summary>
        /// <param name="accesstoken"></param>
        /// <returns></returns>
        public static string GetJsApiTicketUrl(string accesstoken)
        {
            string jsapiTickerUrl = string.Format("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={0}&type=jsapi", accesstoken);
            return jsapiTickerUrl;
        }
        /// <summary>
        /// 小程序授权登录url
        /// </summary>
        /// <param name="appid"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        public static string Getjscode2session(string appid, string code)
        {
            string jscodeurl = string.Format("https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret=2be6b73be25aedfef712de9fd9462f0e&js_code={1}&grant_type=authorization_code", appid, code);
            return jscodeurl;
        }
        /// <summary>
        /// 统一下单url
        /// </summary>
        /// <returns></returns>
        public static string GetUnifiedorderUrl()
        {
            string unifiedorderUrl = string.Format("https://api.mch.weixin.qq.com/pay/unifiedorder");
            return unifiedorderUrl;
        }
    }
}
